package BaiDu;

import java.util.Scanner;

public class Main2 {
    static int mod=1000000007;
    static int res=0;
    public static void backtrack(int[] nums,int k,int index,long sum){
        if (k==0&&sum!=0&&sum%2==0){
            res=(res+1)%mod;
            return;
        }
        if (k<0||index>=nums.length){
            return;
        }
        if (nums.length-k<index){
            return;
        }
        for (int i = index; i < nums.length; i++) {
            backtrack(nums,k-1,i+1,sum+nums[i]);
        }
    }
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int T=cin.nextInt();
        for (int t = 0; t < T; t++) {
            int n=cin.nextInt(),k=cin.nextInt();
            int[] nums=new int[n];
            for (int i = 0; i < n; i++) {
                nums[i]=cin.nextInt();
            }
            res=0;
            backtrack(nums,k,0,0);
            System.out.println(res);
        }
    }
}
